﻿using System.Configuration;
using System.Web;
using System.Xml;

namespace KD.Service.HR.Utility
{
    public static class AppConfig
    {
        public static string GetServiceHost(ApiService service)
        {
            var xml = new XmlDocument();
            xml.Load(HttpContext.Current.Server.MapPath("/App_Setting/ServiceApiHosts.xml"));
            var root = xml.DocumentElement;
            if (root == null) return null;
            var api = root.SelectSingleNode(string.Format("//api[@name='{0}']", service));
            if (api == null) return null;
            var host = api.SelectSingleNode("host");
            return host == null ? null : host.InnerText;
        }

    }
}
